import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceSettingVO, ServiceSettingForm, ServiceSettingQuery } from '@/api/office/service/setting/types';

/**
 * 查询服务包设置列表
 * @param query
 * @returns {*}
 */

export const listServiceSetting = (query?: ServiceSettingQuery): AxiosPromise<ServiceSettingVO[]> => {
  return request({
    url: '/office/service/setting/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务包设置详细
 * @param id
 */
export const getServiceSetting = (id: string | number): AxiosPromise<ServiceSettingVO> => {
  return request({
    url: '/office/service/setting/' + id,
    method: 'get'
  });
};

/**
 * 新增服务包设置
 * @param data
 */
export const addServiceSetting = (data: ServiceSettingForm) => {
  return request({
    url: '/office/service/setting',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务包设置
 * @param data
 */
export const updateServiceSetting = (data: ServiceSettingForm) => {
  return request({
    url: '/office/service/setting',
    method: 'put',
    data: data
  });
};

export const switchStatus = (id: string | number, enableStatus: string) => {
  return request({
    url: '/office/service/setting/' + id + '/' + enableStatus,
    method: 'put'
  });
};

/**
 * 删除服务包设置
 * @param id
 */
export const delServiceSetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/office/service/setting/' + id,
    method: 'delete'
  });
};
